import * as  companyApi  from '@/api/hmmm/companys'
const state = {
    companyList: {}
}
const mutations = {
    SET_COMPANY_LIST: (state, newValue) => {
        newValue.data.items = newValue.data.items.map((item, i) => ({
            ...item,
            index: (newValue.data.page - 1) * newValue.data.pagesize + (i + 1)
        }))
        state.companyList = newValue
    }
}
const actions = {
    async updateCompanyList({ commit }, params) {
        const res = await companyApi.list(params)
        commit('SET_COMPANY_LIST', res)
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}
  